]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Notify when notifications are acknowledged
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 14 Feb 2015 01:33:54 +0000 (02:33 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 20 Feb 2015 16:40:48 +0000 (17:40 +0100)
Source::count-updated is emitted as notifications are added or removed,
which is correct for the primary notification count. However it is not
for the unseen count, which will also change when a notification is
acknowledged without being removed. At the moment this does not matter,
as the unseen count is only used on the screen shield and notifications
are never acknowledged while the screen is locked. However we will soon
use the unseen count in the normal session as well, so emit the signal
in this case too.

https://bugzilla.gnome.org/show_bug.cgi?id=744850

js/ui/messageTray.js

index 9a56bd7c27ecf86196c115cca2ddc5326d027b5a..7d22a425b37868e06a32ea11fb093a708f433828 100644 (file)
@@ -480,7 +480,7 @@ const Notification = new Lang.Class({
         this.forFeedback = false;
         this.expanded = false;
         this.focused = false;
-        this.acknowledged = false;
+        this._acknowledged = false;
         this._destroyed = false;
         this._customContent = false;
         this.bannerBodyText = null;
@@ -822,6 +822,17 @@ const Notification = new Lang.Class({
         return this.addButton(button, callback);
     },
 
+    get acknowledged() {
+        return this._acknowledged;
+    },
+
+    set acknowledged(v) {
+        if (this._acknowledged == v)
+            return;
+        this._acknowledged = v;
+        this.emit('acknowledged-changed');
+    },
+
     setUrgency: function(urgency) {
         this.urgency = urgency;
     },
@@ -1292,6 +1303,7 @@ const Source = new Lang.Class({
             return;
 
         notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy));
+        notification.connect('acknowledged-changed', Lang.bind(this, this.countUpdated));
         this.notifications.push(notification);
         this.emit('notification-added', notification);